fix: await models.dev cache refresh when stale or missing#176
Merged
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #175
This fixes ProviderModelNotFoundError when using short model names like `kimi-k2.5-free` on fresh installations or after new models are added. The root cause was a race condition in ModelsDev.get() where the refresh() call was not awaited, causing the agent to use stale or empty cache data before the refresh completed. Changes: - Await refresh() when cache file doesn't exist (first run) - Await refresh() when cache is stale (> 1 hour old) - Only trigger background refresh when cache is fresh - Add detailed logging for cache state debugging - Add unit tests for ModelsDev module - Add case study documentation Fixes #175 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
echo 'hi' | agent --model kimi-k2.5-free is not working on macOSCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit fb85999.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the
ProviderModelNotFoundErrorwhen using short model names likekimi-k2.5-freeon macOS (and other platforms).Root Cause: Race condition in
ModelsDev.get()where therefresh()call was not awaited, causing the agent to use stale or empty cache data before the network refresh completed.Fix: Properly handle cache staleness:
refresh()when cache file doesn't exist (first run)refresh()when cache is stale (> 1 hour old)Changes
Test Plan
echo 'hi' | agent --model kimi-k2.5-freeRelated Issues
echo 'hi' | agent --model kimi-k2.5-freeis not working on macOS #175References
🤖 Generated with Claude Code